@extends('app')

@section('content')

@if ($errors->any())
        <div class="alert alert-danger">
            @foreach($errors->all() as $error)
                <p>{{ $error }}</p>
            @endforeach
        </div>
    @endif
<ul class="nav nav-tabs">
    <li ><a href="{{ url('/admin/enterprise/job_type')}}">职位分类</a></li>
    <li class="active"><a href="{{ url('/admin/enterprise/companys_type/add') }}">添加</a></li>
</ul>
<form method="POST" action="{{ url('/admin/enterprise/job_type/') }}" class="form-inline">
    <div class="panel panel-default mt20">
        <div class="main">
        
        <div class="form-group">
            <label>分类名称：</label>
            <input type="text" class="form-control" name="cat_name" id="cat_name" @if(!empty($cate_name)) value="{{ $cate_name }}" @endif>
        </div>
        @if($blademode == "edit")
        <input type="hidden" name="cat_id" value="{{ $cate_id }}">
        <div class="form-inline mt20">
            <div class="form-group" id="parent">
                <label>选择分类：</label>
                <select name="type" class="form-control" id="type" onchange="getCompanyTypeChilds(this.value,'parent', 'cat_id', 'companyjobtype')">
                    <option value="0">主分类</option>
                    @foreach($type as $tp)
                    <option value="{{ $tp->cat_id }}" @if(($tp->cat_id == $cates->cat_id) && $up > 0) selected @endif>{{ $tp->name }}</option>
                    @endforeach
                </select>
            </div>
            <div class="form-group ml30" id="child_1">
                @if(count($upcategory) > 0)
                <select name="child_1" class="form-control" id="child_1" onchange="getCompanyTypeChilds(this.value,child,'cat_id', 'companyjobtype')">
                    <option value="0">请选择分类</option>
                    @foreach($upcategory as $upc)
                    <option value="{{ $upc->cat_id }}"  @if($upc->cat_id == $second_cates->cat_id ) selected @endif>{{$upc->name}}</option>
                    @endforeach
                </select>
                @endif
            </div>
        </div>
        @else
        @if(!empty($cates) && count($cates)>0)
        <div class="form-inline mt20">
            <div class="form-group" id="parent">
                <label>上级分类：</label>
                <select name="type" class="form-control" id="type">
                    <option value="{{ $cates->cat_id }}" selected>{{ $cates->name }}</option>
                </select>
            </div>
        </div>
        @else
        <div class="form-inline mt20">
            <div class="form-group" id="parent">
                <label>上级分类：</label>
                <select name="type" class="form-control" id="type" onchange="getCompanyTypeChilds(this.value,'parent', 'cat_id', 'companyjobtype')">
                    <option value="0">主分类</option>
                    @foreach($type as $tp)
                    <option value="{{ $tp->cat_id }}">{{ $tp->name }}</option>
                    @endforeach
                </select>
            </div>
            <div class="form-group ml30" id="child_1"></div>
            <div class="form-group ml30" id="child_2"></div>
            <div class="form-group ml30" id="child_3"></div>
        </div>
        @endif
        @endif
        <div class="form-inline mt20">
            <div class="form-group">
                <label>首页推荐：</label>
                <label class="radio-inline">
                  <input type="radio" name="is_recommond" value="1" @if(!empty($is_recommond)&& $is_recommond == 1) checked @endif> 是
                </label>
                <label class="radio-inline">
                  <input type="radio" name="is_recommond"  value="0" @if(empty($is_recommond) || $is_recommond == 0) checked @endif> 否
                </label>
                
            </div>
        </div>
        <div class="form-inline mt20">
            <div class="form-group">
                <label>分类排序：</label>
                <input type="number" class="form-control" name="sort" id="sort" @if(isset($cate_sort)) value="{{ $cate_sort }}" @endif>
            </div>
        </div>
        </div>
    </div>
    {!! csrf_field() !!}
    <div class="form-inline mt20">
        <div class="form-group">
            <input type="hidden" name="stauts" value="1">
            <input type="submit" class="btn btn-info" id="save" value="submit" />
        </div>
        <div class="form-group ml30">
            <input type="reset" class="btn" value="reset" />
        </div>
    </div>
</form>
@endsection
